<div class="container" id="ajax_content">
    <?php
        include 'header2.php';
    ?>
    <div class="content">
    	<div class="headcontent">
            <span class="randomtext" style="margin-left:50px">Hi,
            <?php
                global $session;
                $user_id = $session->get('userid');
                $sql="SELECT fullname FROM user WHERE iduser='$user_id'";
		$result=mysql_query($sql);
		while($res = mysql_fetch_array($result)) {
                    $nama = $res['fullname'];
		}
		echo $nama;
            ?>
            </span>
            <span class="randomtext" style="padding-left:900px">HOME</span>
            <hr/>
        </div>
    	<div class="singlecontent" style="width:1210px; height:auto">
            <?php
			global $session;
			$user_id = $session->get('userid');

			$sql_tag = "SELECT * FROM foto WHERE iduser='$user_id'";
						$result_tag = mysql_query($sql_tag);
						while($res_tag = mysql_fetch_array($result_tag)){
							$nama_tag = $res_tag['pic'];
							$des = $res_tag['deskripsi'];
							$id_foto = $res_tag['idfoto'];
		?>
        	<a href="<?php echo BASE_PATH;?>pdetail/index/<?php echo $id_foto?>">
        	<img src="<?php echo $nama_tag?>" alt="<?php echo $des?>" height="100" width="100" style="margin-top:10px; " /></a>
        <?php
							}
		?>
        <div class="clearboth"></div>

        <div class="clearboth"></div>
        <div>
        	<span class="randomtext" style="padding-left:980px">FOTO TERBARU</span>
            <?php
			$nilai = 0;
			$sql_tag = "SELECT * FROM foto WHERE iduser='$user_id'";
						$result_tag = mysql_query($sql_tag);
						while($res_tag = mysql_fetch_array($result_tag)){
							$nilai_foto = $res_tag['tgl_upload'];

							if ($nilai <= $nilai_foto)
							{
								$nilai = $nilai_foto;
							}
						}
			$sql_tag2 = "SELECT * FROM foto WHERE iduser='$user_id' and nilai='$nilai'";
						$result_tag = mysql_query($sql_tag2);
						while($res_tag = mysql_fetch_array($result_tag)){
							$nama_tag = $res_tag['pic'];
							$des = $res_tag['deskripsi'];
							$id_foto = $res_tag['idfoto'];
							}
		?>
        	<a href="<?php echo BASE_PATH;?>pdetail/index/<?php echo $id_foto?>">
        	<img src="<?php echo $nama_tag?>" alt="<?php echo $des?>" height="100" width="100" style="margin-top:10px; " />
        </a>
        </div>
        <div>
        	<span class="randomtext" style="padding-left:980px">FOTO TERPOPULER</span>
            <?php
			$sql_tag = "SELECT * FROM foto WHERE iduser='$user_id'";
						$result_tag = mysql_query($sql_tag);
						while($res_tag = mysql_fetch_array($result_tag)){
							$nama_tag = $res_tag['pic'];
							$des = $res_tag['deskripsi'];
							$id_foto = $res_tag['idfoto'];
		?>
        	<a href="<?php echo BASE_PATH;?>pdetail/index/<?php echo $id_foto?>">
        	<img src="<?php echo $nama_tag?>" alt="<?php echo $des?>" height="100" width="100" style="margin-top:10px; " />
</a>
 <?php
							}
		?>
        </div>
        <div>
        	<span class="randomtext" style="padding-left:980px">FOTO TERTINGI NILAINYA</span>
            <br>
            <?php
			$nilai = 0;
			$sql_tag = "SELECT * FROM foto WHERE iduser='$user_id'";
						$result_tag = mysql_query($sql_tag);
						while($res_tag = mysql_fetch_array($result_tag)){
							$nilai_foto = $res_tag['nilai'];

							if ($nilai <= $nilai_foto)
							{
								$nilai = $nilai_foto;
							}
						}
			$sql_tag2 = "SELECT * FROM foto WHERE iduser='$user_id' and nilai='$nilai'";
						$result_tag = mysql_query($sql_tag2);
						while($res_tag = mysql_fetch_array($result_tag)){
							$nama_tag = $res_tag['pic'];
							$des = $res_tag['deskripsi'];
							$id_foto = $res_tag['idfoto'];
							}
		?>
        <a href="<?php echo BASE_PATH;?>pdetail/index/<?php echo $id_foto?>">
        	<img src="<?php echo $nama_tag?>" alt="<?php echo $des?>" height="100" width="100" style="margin-top:10px; " />
        </div>
    </div>
    <div class="footer"></div>
</div>
<!--      <div class="fotoitem">
                <img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>
      <div class="fotoitem">
            	<img src="images/pudy.jpg" alt="pudy cantik" height="100" width="100" />            </div>-->
<!--      </div>-->
        <div class="clearboth"></div>
<!--    </div>-->
    <div class="footer"></div>
</div>

<?php
    global $session;

    $fullname = $session->get('fullname');
    $status = $session->get('status');
    if ($status == 1) {
        echo '<div id="fb-root"></div>
              <script src="http://connect.facebook.net/en_US/all.js"></script>
              <script>
                 FB.init({appId:"190729414302878", cookie:true,status:true, xfbml:true});
                 FB.ui({
                    method: "feed",
                    link: "http://www.facebook.com/apps/application.php?id=190729414302878",
                    picture: "https://lh6.googleusercontent.com/_hfC4HVLaFmA/TZBMdiLjQnI/AAAAAAAAABA/bSd_fg9mJgc/logo.png",
                    message: "'.$fullname.' has registered to YOU application"
                 });
              </script>';
    }
    //$status = 0;
    $session->set('status',0);
?>